<template>
  <div>
	  <button @click="getarr">arr</button>
    <textarea v-model="textContent" cols="30" rows="10" readonly maxlength="1000000"></textarea>
	
  </div>
</template>
 
<script>
export default {
  data() {
    return {
      textContent: ''
    };
  },
  mounted() {
    this.loadTextFile('../../peo.txt');
  },
  methods: {
    loadTextFile(filePath) {
      fetch(filePath)
        .then(response => response.text())
        .then(text => {
          this.textContent = text;
        })
        .catch(error => {
          console.error('Error reading file:', error);
        });
    },
	getarr() {
		var arr=this.textContent.split("\r\n")
		console.log(arr);
		var jsonArr=[];
		for (var i = 0; i < arr.length; i++) {
			var line=arr[i];
			var arr2=line.split("\t");
			// {
			// 	no: 'YD00150',
			// 	group: '后工序',
			// 	pno: 'YD00150',
			// 	name: '李钦章'
			// }
			jsonArr.push({
				no:arr2[0],
				group:arr2[1],
				pno:arr2[2],
				name:arr2[3]
			})
		}
		console.log(jsonArr);
	},
	
  }
};
</script>